feat(bitcoin-snap): update to keyring v2 - #43
Merged
Conversation
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
Contributor
Author
|
@SocketSecurity ignore npm/@metamask/snaps-controllers@21.0.0 |
hmalik88
commented
Jul 24, 2026
| transaction: 'notAPsbt', | ||
| }, | ||
| code: -32603, | ||
| message: 'Invalid PSBT', |
Contributor
Author
There was a problem hiding this comment.
Because handleKeyringRequest either throws SnapError or Error , the middleware doesn't catch it as FormatError, hence the "Invalid format: " prefix gets stripped
ccharly
reviewed
Jul 24, 2026
Contributor
Author
|
@metamaskbot publish-preview |
ccharly
previously approved these changes
Jul 29, 2026
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
ccharly
approved these changes
Jul 30, 2026
hmalik88
enabled auto-merge
July 30, 2026 10:21
ulissesferreira
approved these changes
Jul 30, 2026
Battambang
added a commit
that referenced
this pull request
Jul 30, 2026
Sync with bitcoin keyring v2 (#43) and regenerate yarn.lock after resolving the lockfile conflict.
Battambang
added a commit
that referenced
this pull request
Jul 30, 2026
Bump snaps-cli, snaps-sdk, superstruct, keyring-api, and keyring-snap-sdk declarations to match bitcoin-/tron-wallet-snap after #43 (installed versions unchanged).
This was referenced Jul 30, 2026
Closed
Merged
taran-a
pushed a commit
that referenced
this pull request
Aug 4, 2026
Bump snaps-cli, snaps-sdk, superstruct, keyring-api, and keyring-snap-sdk declarations to match bitcoin-/tron-wallet-snap after #43 (installed versions unchanged).
jeremytsng
pushed a commit
that referenced
this pull request
Aug 5, 2026
fix: read resolveAccountAddress from params.opts.address (SEP-43)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Original PR & reviewer comments here: MetaMask/snap-bitcoin-wallet#645
Migrates the Bitcoin snap to the v2 Keyring API and declares the corresponding capabilities in the manifest. Also removes all v1-only keyring methods and replaces the manual routing table with the v2 dispatcher.
Rewrites
KeyringHandlerto implementKeyringSnapRpc(from@metamask/keyring-api/v2): addsgetAccounts,getAccount,createAccounts,exportAccount,getAccountBalances,getAccountAssets,getAccountTransactions,deleteAccount,submitRequest,setSelectedAccounts, andresolveAccountAddressRemoves v1-only flows (
createAccount,discoverAccounts,filterAccountChains,updateAccount) and stops emittingAccountCreated/AccountDeletedeventsFolds
bip44:discoverintocreateAccounts: callsAccountUseCases.discover(), deletes the account from state if no transactions are found, and returns[]to signal end-of-discoveryAdds
exportAccountwith WIF private-key export (Base58Check, version byte 0x80/0xEF); usesis()notassert()to prevent the private key from appearing in aStructErrormessage on encoding failureReads
SUPPORTED_SCOPESdirectly fromsnap.manifest.jsoncapabilities block (same pattern as Solana snap) instead of hardcoding the networkSwitches
handleKeyringRequestto the v2 dispatcher (@metamask/keyring-snap-sdk/v2)Adds
endowment:keyring.capabilitiestosnap.manifest.json:scopes,privateKey.exportFormats, andbip44 derive/discoverflagsSets
module: "ESNext"andmoduleResolution: "bundler"inpackages/snap/tsconfig.jsonso /v2 subpath exports resolve correctlyBumps
@metamask/keyring-api → ^23.5.0,keyring-snap-sdk → ^9.2.0,snaps-sdk → ^11.2.0,snaps-cli → ^8.4.1,snaps-jest → ^10.2.0Updates
KeyringHandler.test.ts: removes v1-only describe blocks, addsexportAccountandbip44:discovercoverage, mockswifmodule, addsbeforeEach(() => jest.resetAllMocks())to fix mock-call accumulation between testsReferences
N/A
Checklist